﻿@{
    ViewBag.Title = "About Us";
}

<h2>About</h2>

@{
    List<string> refs = new List<string>();
    Queue<System.Reflection.AssemblyName> pending = new Queue<System.Reflection.AssemblyName>();
    pending.Enqueue(System.Reflection.Assembly.GetAssembly(typeof(MTO.Library.Web.MvcApplication)).GetName());
    
    while (pending.Count > 0)
    {
        System.Reflection.AssemblyName an = pending.Dequeue();
        string s = an.ToString();
        
        if (refs.Contains(s))
        {
            continue; // done already
        }
        
        refs.Add(s);
        
        try
        {
            System.Reflection.Assembly asm = System.Reflection.Assembly.Load(an);
            
            if (asm != null)
            {
                foreach (System.Reflection.AssemblyName sub in asm.GetReferencedAssemblies())
                {
                    pending.Enqueue(sub);
                }
                
                //foreach (Type type in asm.GetTypes())
                //{
                //    foreach (System.Reflection.MethodInfo method in type.GetMethods(
                //        System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public |
                //             System.Reflection.BindingFlags.NonPublic))
                //    {
                //        System.Runtime.InteropServices.DllImportAttribute attrib = (System.Runtime.InteropServices.DllImportAttribute)
                //            Attribute.GetCustomAttribute(method,
                //                typeof(System.Runtime.InteropServices.DllImportAttribute));
                //        if (attrib != null && !refs.Contains(attrib.Value))
                //        {
                //            refs.Add(attrib.Value);
                //        }
                //    }
                //}
            }
        }
        catch (Exception ex)
        {
            Console.Error.WriteLine(ex.Message);
        }
    }
    
    refs.Sort();
    
    foreach (string name in refs)
    {
        @name <br />
    }
}